package com.sure0000.basic;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

/**
 * @program: demo
 * @description: blockqueue 测试
 * @author: xuyouchang@supcon.com
 * @create: 2019-12-26 16:23
 **/
public class BlockQueue {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<String> queue = new ArrayBlockingQueue<>(10, true);
        for (int i = 0;i < 10; i++) {
            queue.put("a" + i);
        }

        while(true) {
            String ret = queue.take();
            System.out.println(queue.size());
        }
    }
}
